
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class SimpleDigits {
	
	public ArrayList<Integer> GetSimpleDigits(int n) {
		ArrayList<Integer> simpleDigits = new ArrayList<Integer>();
		
		if(n == 1) {
			return simpleDigits;
		}
		
		simpleDigits.add(2);
		
		for(int currentDigit = 3; currentDigit <= n; currentDigit++) {
			simpleDigits.add(currentDigit);
			for(int i = 0; i < simpleDigits.size() - 1; i++) {
				if((currentDigit % simpleDigits.get(i)) == 0) {
					simpleDigits.remove(simpleDigits.size() - 1);
					break;
				}
			}
		}
		
		return simpleDigits;
	}
	
	public static void main(String[] args) {
		int n;
		SimpleDigits myDigits = new SimpleDigits();
		
		while(true) {
			try {
				System.out.println("Input please:");
				BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
				String str = in.readLine();
				n = new Integer(str).intValue();
				if(n < 1) {
					continue;
				}
				break;
			}catch(Exception ex) {
				System.out.println("Input number please!!!");
			}
		}
		
		System.out.println("Your series of primes:");
		System.out.println(myDigits.GetSimpleDigits(n));
	}
}